table of contents
SCRIPT(1) | User Commands | SCRIPT(1) |
NAME¶
script - make typescript of terminal session
SYNOPSIS¶
script [options] [file]
DESCRIPTION¶
script makes a typescript of everything on your terminal session. The terminal data are stored in raw form to the log file and information about timing to another (optional) structured log file. The timing log file is necessary to replay the session later by scriptreplay(1) and to store additional information about the session.
Since version 2.35, script supports multiple streams and allows the logging of input and output to separate files or all the one file. This version also supports new timing file which records additional information. The command scriptreplay --summary then provides all the information.
If the argument file or option --log-out file is given, script saves the dialogue in this file. If no filename is given, the dialogue is saved in the file typescript.
Note that logging input using --log-in or --log-io may record security-sensitive information as the log file contains all terminal session input (e.g., passwords) independently of the terminal echo flag setting.
OPTIONS¶
Below, the size argument may be followed by the multiplicative suffixes KiB (=1024), MiB (=1024*1024), and so on for GiB, TiB, PiB, EiB, ZiB and YiB (the "iB" is optional, e.g., "K" has the same meaning as "KiB"), or the suffixes KB (=1000), MB (=1000*1000), and so on for GB, TB, PB, EB, ZB and YB.
-a, --append
-c, --command command
-E, --echo when
The default is auto — in this case, ECHO enabled for the pseudoterminal slave; if the current standard input is a terminal, ECHO is disabled for it to prevent double echo; if the current standard input is not a terminal (for example pipe: echo date | script) then keeping ECHO enabled for the pseudoterminal slave enables the standard input data to be viewed on screen while being recorded to session log simultaneously.
Note that 'never' mode affects content of the session output log, because users input is not repeated on output.
-e, --return
-f, --flush
--force
-B, --log-io file
-I, --log-in file
Use this logging functionality carefully as it logs all input, including input when terminal has disabled echo flag (for example, password inputs).
-O, --log-out file
-T, --log-timing file
-m, --logging-format format
Classic format
Advanced (multi-stream) format
-o, --output-limit size
-q, --quiet
-t[file], --timing[=file]
-V, --version
-h, --help
SIGNALS¶
Upon receiving SIGUSR1, script immediately flushes the output files.
ENVIRONMENT¶
The following environment variable is utilized by script:
SHELL
NOTES¶
The script ends when the forked shell exits (a control-D for the Bourne shell (sh(1p)), and exit, logout or control-d (if ignoreeof is not set) for the C-shell, csh(1)).
Certain interactive commands, such as vi(1), create garbage in the typescript file. script works best with commands that do not manipulate the screen, the results are meant to emulate a hardcopy terminal.
It is not recommended to run script in non-interactive shells. The inner shell of script is always interactive, and this could lead to unexpected results. If you use script in the shell initialization file, you have to avoid entering an infinite loop. You can use for example the .profile file, which is read by login shells only:
if test -t 0 ; then
script
exit fi
You should also avoid use of script in command pipes, as script can read more input than you would expect.
HISTORY¶
The script command appeared in 3.0BSD.
BUGS¶
script places everything in the log file, including linefeeds and backspaces. This is not what the naive user expects.
script is primarily designed for interactive terminal sessions. When stdin is not a terminal (for example: echo foo | script), then the session can hang, because the interactive shell within the script session misses EOF and script has no clue when to close the session. See the NOTES section for more information.
SEE ALSO¶
csh(1) (for the history mechanism), scriptreplay(1), scriptlive(1)
REPORTING BUGS¶
For bug reports, use the issue tracker at <https://github.com/karelzak/util-linux/issues>.
AVAILABILITY¶
The script command is part of the util-linux package which can be downloaded from Linux Kernel Archive <https://www.kernel.org/pub/linux/utils/util-linux/>.
2022-02-14 | util-linux 2.37.4 |